<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>安全设置 - <{$common.site_name}></title>
<link rel="stylesheet" type="text/css" href="<{$common.theme}>/style/general.css" />
<link rel="stylesheet" type="text/css" href="<{$common.theme}>/style/user.css" />
<script type="text/javascript" src="<{$common.theme}>/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="<{$common.theme}>/js/juicer.js"></script>
<script type="text/javascript" src="<{$common.theme}>/js/general.js"></script>
<script type="text/javascript">
function changeEmail(){
  var container = $('#change-email');
  container.slideDown().find('button').eq(0).on('click', function(){
    container.find('input[name="new_email"]').vdsChecker({email:true});
    container.find('form').vdsSubmit(true);
  });
  container.slideDown().find('button').eq(1).on('click', function(){
    container.slideUp().find('span.vds-warning').remove();
  });
}

function resetPwd(){
  var container = $('#reset-pwd');
  container.slideDown().find('button').eq(0).on('click', function(){
    var old_pwd = container.find('input[name="old_password"]'),
    new_pwd = container.find('input[name="new_password"]'),
    re_pwd = container.find('input[name="repassword"]');
    old_pwd.vdsChecker({required:true});
    new_pwd.vdsChecker({password:true}, {password:'新密码不符合格式要求'}, {password: /^[\\~!@#$%^&*()-_=+|{}\[\],.?\/:;\'\"\d\w]{6,31}$/.test(new_pwd.val())});
    re_pwd.vdsChecker({equal:new_pwd.val()}, {equal:'两次密码不一致'});
    container.find('form').vdsSubmit(true);
  });
  container.slideDown().find('button').eq(1).on('click', function(){
    container.slideUp().find('span.vds-warning').remove();
  });
}
</script>
</head>
<body>
<!-- 顶部开始 -->
<{layout_topper common=$common}>
<!-- 顶部结束 -->
<!-- 头部开始 -->
<{layout_header common=$common}>
<!-- 头部结束 -->
<div class="loc w1100">
  <div><a href="<{$common.url}>">网站首页</a><b>&gt;</b><font>用户面板</font></div>
</div>
<!-- 主体开始 -->
<div class="container w1100 mt10">
  <div class="module cut">
    <!-- 左侧开始 -->
    <div class="w180 fl cut">
      <!-- 用户菜单开始 -->
      <{layout_usermenu}>
      <!-- 用户菜单结束 -->
    </div>
    <!-- 左侧结束 -->
    <!-- 右侧开始 -->
    <div class="w910">
      <div class="profile mcter">
        <h2>安全设置</h2>
        <div class="form cut">
          <dl>
            <dt><label>登录用户：</label></dt>
            <dd><font class="c666"><{$user.username}></font></dd>
          </dl>
          <dl>
            <dt><label>绑定邮箱：</label></dt>
            <dd><font class="c666"><{$user.email}></font> <a class="ml5 pointer" onclick="changeEmail()">更换邮箱</a><{if $user.email_status == 0}><span class="red ml5">(还未通过邮箱认证，点击<a href="<{url c='user' a='security' step='send_validate_mail'}>">发送认证邮件</a>)</span><{/if}></dd>
            <dd>
              <div class="styhide change mt5 pad10 hide" id="change-email">
                <form method="post" action="<{url c='user' a='security' step='change_email'}>">
                  <font class="c666 mr5">新邮箱地址：</font>
                  <input class="txt" type="text" name="new_email" data-warnpos="br"  />
                  <button class="sm-blue ml5" type="button">提交</button>
                  <button class="sm-gray ml5" type="button">取消</button>
                </form>
              </div>
            </dd>
          </dl>
	  <{if !empty($user.oauth_list)}>
	  <dl>
            <dt><label>第三方账号：</label></dt>
            <dd>
	      <{foreach $user.oauth_list as $v}>
	      <a class="mr10" title="解除绑定" href="<{url c='user' a='security' step='oauth_unbind' party=$v.party}>"><img src="<{$common.url}>/plugin/oauth/icon/<{$v.party}>.png" border="0" /></a>
	      <{/foreach}>
	    </dd>
          </dl>
	  <{/if}>
          <dl>
            <dt>上次登录：</dt>
            <dd>
              <p class="c666"><{date('Y年m月d日 H:i', $user.last_date)}> <font class="c888 ml5">[<{$user.last_ip}>]</font></p>
              <p class="c888">不是您登录的？请立即<a class="pointer" onclick="resetPwd()">更改密码</a></p>
            </dd>
            <dd>
              <div class="styhide reset mt5 pad10 hide" id="reset-pwd">
                <form method="post" action="<{url c='user' a='security' step='reset_pwd'}>">
                  <table width="100%" cellspacing="0" cellpadding="0">
                    <tr>
                      <th width="100">原密码：</th>
                      <td><input title="原密码" type="password" name="old_password" class="txt" data-warnpos="br" /></td>
                    </tr>
                    <tr>
                      <th>新密码：</th>
                      <td><input type="password" name="new_password" class="txt" data-warnpos="br" /></td>
                    </tr>
                    <tr>
                      <th>确认新密码：</th>
                      <td><input title="确认新密码" type="password" name="repassword" class="txt" data-warnpos="br" /></td>
                    </tr>
                  </table>
                  <div class="resetbtn">
                    <button class="sm-blue mr20" type="button">确定并提交</button>
                    <button class="sm-gray" type="button">取消</button>
                  </div>
                </form>
              </div>
            </dd>
          </dl>
        </div>
      </div>
    </div>
    <!-- 右侧结束 -->
  </div>
  <div class="cl"></div>
  <{layout_helper}>
</div>
<!-- 主体结束 -->
<div class="cl"></div>
<!-- 页脚开始 -->
<{layout_footer}>
<!-- 页脚结束 -->
</body>
</html>